/**
 *   DataSlim - Lazy Loading Framework
 *   Copyright (C) 2007 Rodolfo Dias
 *   
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License along
 *   with this program; if not, write to the Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 
 */

package net.dataslim.processor;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;

import com.sun.mirror.apt.AnnotationProcessor;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.apt.AnnotationProcessorFactory;
import com.sun.mirror.apt.AnnotationProcessors;
import com.sun.mirror.declaration.AnnotationTypeDeclaration;

public class DataSlimAnnotationFactory implements AnnotationProcessorFactory
{
	/**
	 * Retorna o processador para os annotations do DataSlim
	 * @return Um annotation processor para o note annotations se requisitado, senao,
	 * retorna NO_OP annotation processor.
	 * 
	 */
	public AnnotationProcessor getProcessorFor(
			Set<AnnotationTypeDeclaration> declarations,
			AnnotationProcessorEnvironment env){
		
			AnnotationProcessor result;
			if (declarations.isEmpty()){
				result = AnnotationProcessors.NO_OP;
			}else{
				result = new DataSlimAnnotationProcessor(env);
			}
			return result;
	}
	
	public Collection<String> supportedAnnotationTypes(){
		Collection<String> list = new ArrayList<String>();
		list.add("net.dataslim.annotations.DataSlim");
		return list;
	}
	
	public Collection<String> supportedOptions(){
		return Collections.emptyList();
	}
}
